#include <math.h>

typedef struct
{
	double x,y,z;
} Vector3;

Vector3 vecAdd(Vector3 a, Vector3 b)
{
	Vector3 result;
	result.x = a.x + b.x;
	result.y = a.y + b.y;
	result.z = a.z + b.z;
	return result;
}

Vector3 vecSub(Vector3 a, Vector3 b)
{
	Vector3 result;
	result.x = a.x - b.x;
	result.y = a.y - b.y;
	result.z = a.z - b.z;
	return result;
}

Vector3 vecDiv(Vector3 a, double value)
{
	Vector3 result;
	result.x = a.x / value;
	result.y = a.y / value;
	result.z = a.z / value;
	return result;
}

Vector3 vecMult(Vector3 a, double value)
{
	Vector3 result;
	result.x = a.x * value;
	result.y = a.y * value;
	result.z = a.z * value;
	return result;
}

double vecLength(Vector3 a)
{
	return (double) sqrt(pow(a.x,2) + pow(a.y,2) + pow(a.z,2));
}


